<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
     var m = 1;
    function f1() {
        console.log(m);  //1
    }
    function f3() {
        function f2() {
            f1(m);
        }

        f2();
        var m = 3;
    }
    f3();

    </script>
</body>
</html>